/*
 * RepairBO.java
 *
 * Created on March 22, 2007, 6:38 PM
 */

package Data;

import java.util.Date;

/**
 *
 * @author Dallin Regehr
 */
public class RepairBO {
    
    private String id;
    private Date startDate;
    private Date completedDate;
    private Date pickedUpDate;
    private String repairDescription;
    private double laborHours;
    private String employeeId;
    private double amount;
    private boolean alreadyInDB = false;
    private boolean dirty = true;
    private RevenueSourceBO revenueSource = null;
    
    /** Creates a new instance of RepairBO */
    public RepairBO(String id) {
        this.id = id;
    }
    public String getId() {
        return id;
    }

    public boolean isAlreadyInDB() {
        return alreadyInDB;
    }

    public void setAlreadyInDB(boolean alreadyInDB) {
        this.alreadyInDB = alreadyInDB;
    }

    public boolean isDirty() {
        return dirty;
    }

    public void setDirty(boolean dirty) {
        this.dirty = dirty;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getCompletedDate() {
        return completedDate;
    }

    public void setCompletedDate(Date completedDate) {
        this.completedDate = completedDate;
    }

    public Date getPickedUpDate() {
        return pickedUpDate;
    }

    public void setPickedUpDate(Date pickedUpDate) {
        this.pickedUpDate = pickedUpDate;
    }

    public String getRepairDescription() {
        return repairDescription;
    }

    public void setRepairDescription(String description) {
        this.repairDescription = description;
    }

    public double getLaborHours() {
        return laborHours;
    }

    public void setLaborHours(double laborHours) {
        this.laborHours = laborHours;
    }

    public EmployeeBO getEmployee() throws DataException {
        EmployeeBO emp=null;
        try{
        emp = EmployeeDAO.getInstance().read(employeeId);
        }catch (DataException e){
            throw new DataException("Could not read employee on repair.",e);
        }
        return emp;
    }

    public void setEmployee(EmployeeBO emp) {
        this.employeeId = emp.getId();
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public RevenueSourceBO getRevenueSource() {
        return revenueSource;
    }

    public void setRevenueSource(RevenueSourceBO revenueSource) {
        this.revenueSource = revenueSource;
    }
}
